package com.apes.auto.car.service;

import com.apes.auto.car.model.CarElectronicCatalogue;
import com.apes.auto.car.repository.CarElectronicCatalogueRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName CarElectronicCatalogueService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/8/5 9:57
 * @Version 1.0
 **/
@Service("carElectronicCatalogueService")
public class CarElectronicCatalogueService extends DomainService {

    @Autowired
    private CarElectronicCatalogueRepository carElectronicCatalogueRepository;

    public CarElectronicCatalogue save(SimpleRequest request) {
        CarElectronicCatalogue o = request.getO(CarElectronicCatalogue.class);
        CarElectronicCatalogue catalogue = carElectronicCatalogueRepository.saveAndFlush(o);
        return catalogue;
    }

    public String delete(SimpleRequest request) {
        CarElectronicCatalogue o = request.getO(CarElectronicCatalogue.class);
        carElectronicCatalogueRepository.delete(o.getPZCXID());
        return "删除成功";
    }
}
